<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// 
//  admin_activity_model.php
//  www.6block.com
//  
//  Created by Will_Lee on 2011-05-21.
//  Copyright 2011 lishuzu. All rights reserved.
// 

class Admin_activity_model extends CI_Model
{
		function __construct(){
			parent::__construct();
			$this->load->model('Activity_model');
		}
		
		function get_activitys(){
			//page
			$_SGLOBAL = $this->config->item('SGLOBAL');
			$_SGLOBAL['multipage_config']['base_url'] = base_url().'admin/admin_activity/index/';
			
			$this->db->where('status >=', 0);
			$_SGLOBAL['multipage_config']['total_rows'] = $this->db->count_all_results('activity');
			$_SGLOBAL['multipage_config']['uri_segment'] = '4';
			$_SGLOBAL['multipage_config']['per_page'] = '20';
			$offset = $this->uri->segment($_SGLOBAL['multipage_config']['uri_segment']);
			$this->pagination->initialize($_SGLOBAL['multipage_config']);
			$data = array();
			$data['activitys'] = $this->Activity_model->get_activitys($_SGLOBAL['multipage_config']['per_page'], $offset);
			$multi = $this->pagination->create_links();
			$data['multi'] = $multi;
			return $data;
		}
		
		function get_downindex_activitys(){
			//page
			$_SGLOBAL = $this->config->item('SGLOBAL');
			$_SGLOBAL['multipage_config']['base_url'] = base_url().'admin/admin_activity/downindex_activity/index/';
			$this->db->where('status', '-2');
			$_SGLOBAL['multipage_config']['total_rows'] = $this->db->count_all_results('activity');
			$_SGLOBAL['multipage_config']['uri_segment'] = '5';
			$_SGLOBAL['multipage_config']['per_page'] = '20';
			$offset = $this->uri->segment($_SGLOBAL['multipage_config']['uri_segment']);
			$this->pagination->initialize($_SGLOBAL['multipage_config']);
			$data = array();
			$data['activitys'] = $this->Activity_model->get_downindex_activitys($_SGLOBAL['multipage_config']['per_page'], $offset);
			$multi = $this->pagination->create_links();
			$data['multi'] = $multi;
			return $data;
		}
}
?>